{{#unless tagserviceactive}}
    <section class="tagservice-section">
        <div class="alert alert-danger">{{{t this "tagservice-disabled"}}}</div>
    </section>
{{/unless}}

<section class="tagservice-section">
    <header class="tagservice-section-header">
        <h3>{{{t this "tagsintagcollection"}}} : {{actualtagcollectionname}}</span></h3>
        <div class="btn-toolbar float-end">
            <a href="{{{newURL this 'tags' 'new'}}}" class="btn btn-primary btn-sm pull-right" {{isExternallyCreated}}>{{{t this "Create Tag"}}}</a>
            <a href="{{baseURL}}" class="btn btn-primary btn-sm pull-right" >{{{t this "Return"}}}</a>
        </div>
    </header>

    <table class="tagservice-table table table-striped table-hover table-condensed">
        <thead>
        <tr>
            <th class="tags-percent-big">{{{t this "tag_label"}}}</th>
            <th>{{{t this "description"}}}</th>
            <th class="tags-percent-total"><!-- actions --></th>
        </tr>
        </thead>
        <tbody>
        {{#if tagsintagcollection.length}}
            {{#each tagsintagcollection}}
                <tr>
                    <td>{{this.tagLabel}}</td>
                    <td>{{this.description}}</td>
                    <td class="actions">
                        <a href="{{{actionURL this 'tags' this.tagId "delete"}}}" class="btn btn-warning btn-xs tagservice-delete-btn" data-record-type="tag" {{isExternallyCreated}} aria-label="{{{t this "Delete Tag"}}}" title="{{{t this "Delete Tag"}}}"><span class="fa fa-trash" aria-hidden="true"></span></a>
                        <a href="{{{actionURL this 'tags' this.tagId "edit"}}}" class="btn btn-primary btn-xs">{{{t this editLabel}}}</a>
                    </td>
                </tr>
            {{/each}}
        {{else}}
            <tr>
                <td colspan="3" class="text-center">
                    <div class="alert alert-info" style="margin-top: 15px;">
                        {{{t this "no_tags_in_collection"}}}
                    </div>
                </td>
            </tr>
        {{/if}}
        </tbody>
    </table>


    <!--pagination param ==> currentPage:{{pageNum}} totalPageCount:{{totalPages}} countPerPageGroup:{{countPerPageGroup}}-->
    {{#if showPagination}}
        {{#pagination this pageNum totalPages countPerPageGroup}}
            <div class="paging_bootstrap">
                <ul class="pagination">
                    {{#if canGoPrevious}}
                        <li class="page-item prev"><a class="page-link" href="{{actionURLPaginated this 'tagsintagcollection' uuid "manage" previousIdx pageSize}}"><i class="icon-double-angle-left">&Lt;</i></a></li>
                    {{else}}
                        <li class="page-item prev disabled"><a class="page-link" href="#"><i class="icon-double-angle-left">&Lt;</i></a></li>
                    {{/if}}

                    {{#each pages}}
                        <li {{#if isCurrent}}class="page-item active"{{/if}}><a class="page-link" href="{{actionURLPaginated this 'tagsintagcollection' uuid "manage" pageInt pageSize}}">{{page}}</a></li>
                    {{/each}}

                    {{#if canGoNext}}
                        <li class="page-item next"><a class="page-link" href="{{actionURLPaginated this 'tagsintagcollection' uuid "manage" nextIdx pageSize}}"><i class="icon-double-angle-right">&Gt;</i></a></li>
                    {{else}}
                        <li class="page-item next disabled"><a class="page-link" href="#"><i class="icon-double-angle-right">&Gt;</i></a></li>
                    {{/if}}
                </ul>
            </div>
        {{/pagination}}
    {{/if}}
</section>

<script id="tagserviceDeleteConfirmationModalTemplate" type="text/template">
    <div class="tag-modal modal fade" id="tagserviceDeleteConfirmationModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">
                        {if recordType == "tag"}
                        {{{t this "Delete Tag"}}}
                        {/if}
                    </h4>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{{t this "Close"}}}"></button>
                </div>
                <div class="modal-body">
                    <p>
                        {if recordType == "tag"}
                        {{{t this "Are you sure you want to delete this tag?"}}}
                        {/if}
                    </p>
                </div>
                <div class="modal-footer">
                    <form action="${deleteURL}" method="POST">
                        <button type="submit" class="button btn-primary btn-sm">
                            {if recordType == "tag"}
                            {{{t this "Delete Tag"}}}
                            {/if}
                        </button>
                        <button type="button" class="button btn-sm" data-bs-dismiss="modal">{{{t this "Close"}}}</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</script>
